#!/bin/bash
# name: centos-init.sh

# Basic packages
echo "================== install net-tools yum-utils vim wget bash-completion lrzsz mlocate tree =================="
sleep 3
yum -y install net-tools yum-utils vim wget bash-completion lrzsz mlocate tree

# disable selinux
echo "================== disable selinux =================="
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
cat /etc/selinux/config
sleep 3

# disable firewalld and postfix
echo "================== disable firewalld postfix =================="
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop postfix.service
systemctl disable postfix.service
sleep 3

# sshd config
echo "================== sshd config =================="
sed -i "s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g" /etc/ssh/sshd_config
sed -i "s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g" /etc/ssh/sshd_config
sed -i "s/X11Forwarding yes/X11Forwarding no/g" /etc/ssh/sshd_config
sed -i "s/^#UseDNS.*/UseDNS no/g" /etc/ssh/sshd_config
cat /etc/ssh/sshd_config | grep  -E "^GSSAPIAuthentication|^ListenAddress|^X11Forwarding|^UseDNS"
systemctl restart sshd.service